"""

author:Jin


"""
#用户输入账号密码
cur_username = input("请输入用户名")
cur_userpasswd = input("请输入密码")
if cur_username != None and cur_userpasswd != None:
    cur_stat = 1
else:
    cur_stat = 0
#设置权限用户
permission_user = {"name":"root","passwd":"123456"}

def login_required(func):
    def _login_required(*args):
        if  cur_stat == 1 :
            print("当前为登陆状态")
            ret = func(*args)
            return ret
        else:
            print("用户未登录")
    return _login_required

def permission_allowed(func):
    def _permission_allowed(*args):
        if cur_username == permission_user["name"] and cur_userpasswd == permission_user["passwd"]:
            print("权限足够")
            ret = func(*args)
            return ret
        else:
            print("权限不够")
    return _permission_allowed

@login_required
@permission_allowed
def func1(num1,num2):
    print("欢迎用加法")
    return num1 + num2


tmp = func1(2,3)
print(tmp)
